const CDBSave = require('./dbsave');

class User_evaluation extends CDBSave.CDBSave{
    constructor(){
        super();
    }

    filePath(){
        return 'User_Evaluation_changda.json'
    }

    load(data){
        if(!data){return;}
        this.notices = data;
    }


    save(){
        return this.notices;
    }

    add_evaluation(message){
        let id = this.notices.length + 1;
        message.id = id;
        let add_Eva = new evaluation_child(message);
        this.notices.push(add_Eva);
    }
}


class evaluation_child{
    constructor(message){
        this.load(message);
    }


    load(data){
        this.id = data.id;
        this.type = data.type;
        this.content = data.content;
    }

    save(){
        return{
            id:this.id,
            type:this.type,
            content:this.content
        }
    }
}

module.exports = {User_evaluation,evaluation_child}